import hashdb_output
import platform
import os

# Defaults for all settings

CONFIG_VERBOSITY         = hashdb_output.DEFAULT

CONFIG_CONFIGROOT        = '/etc/hashdb.conf'
CONFIG_CONFIGUSER        = os.path.expanduser('~/.hashdb.conf')
CONFIG_CONFIGS           = [CONFIG_CONFIGROOT, CONFIG_CONFIGUSER]

CONFIG_UPDATEDB          = '/etc/updatedb.conf'

CONFIG_WALK_DEPTH        = True

CONFIG_DATABASE          = '/var/lib/hashdb/hashdb.db'
CONFIG_DATABASES_LOCALS  = []
CONFIG_DATABASES_REMOTES = []

CONFIG_SKIP_MOUNTS       = True
CONFIG_SKIP_BINDS        = True
CONFIG_SKIP_SYMLINKS     = False
CONFIG_SKIP_FSTYPES      = []
CONFIG_SKIP_PATHS        = []
CONFIG_SKIP_NAMES        = []
CONFIG_SKIP_DIRNAMES     = []
CONFIG_SKIP_FILENAMES    = []

CONFIG_HASH_DEFINITIVE   = False
CONFIG_HASH_FORCE        = False
CONFIG_HASH_TARGETS      = ['./']

CONFIG_MATCH_VERIFY      = True
CONFIG_MATCH_TARGETS     = ['./']

CONFIG_VIEW_LOCALS       = []
CONFIG_VIEW_REMOTES      = []
CONFIG_VIEW_DATABASES    = []
CONFIG_VIEW_TARGETS      = ['./']

CONFIG_QUERY_SQL         = ''

CONFIG_CMD               = 'hash'

if platform.system() == 'Linux':
    if not os.path.exists(CONFIG_UPDATEDB):
        CONFIG_UPDATEDB = None
elif platform.system() == 'Windows':
    CONFIG_CONFIGROOT = None
    CONFIG_CONFIGUSER = os.path.expanduser('~/hashdb.conf')
    CONFIG_CONFIGS    = [CONFIG_CONFIGUSER]
    CONFIG_UPDATEDB   = None
    CONFIG_DATABASE   = os.path.expanduser('~/hashdb.db')
else:
    hashdb_output.log.error('error: Unsupported system (%s)' % platform.system())

CONFIG_MAP = {
    'verbosity': CONFIG_VERBOSITY,
    'configs' : CONFIG_CONFIGS,
    'updatedb' : CONFIG_UPDATEDB,
    'walk_depth' : CONFIG_WALK_DEPTH,
    'database' : CONFIG_DATABASE,
    'databases_locals' : CONFIG_DATABASES_LOCALS,
    'databases_remotes' : CONFIG_DATABASES_REMOTES,
    'skip_mounts' : CONFIG_SKIP_MOUNTS,
    'skip_binds' : CONFIG_SKIP_BINDS,
    'skip_symlinks' : CONFIG_SKIP_SYMLINKS,
    'skip_fstypes' : CONFIG_SKIP_FSTYPES,
    'skip_paths' : CONFIG_SKIP_PATHS,
    'skip_names' : CONFIG_SKIP_NAMES,
    'skip_dirnames' : CONFIG_SKIP_DIRNAMES,
    'skip_filenames' : CONFIG_SKIP_FILENAMES,
    'hash_definitive' : CONFIG_HASH_DEFINITIVE,
    'hash_force' : CONFIG_HASH_FORCE,
    'hash_targets' : CONFIG_HASH_TARGETS,
    'match_verify' : CONFIG_MATCH_VERIFY,
    'match_targets' : CONFIG_MATCH_TARGETS,
    'view_locals' : CONFIG_VIEW_LOCALS,
    'view_remotes' : CONFIG_VIEW_REMOTES,
    'view_databases' : CONFIG_VIEW_DATABASES,
    'query_sql' : CONFIG_QUERY_SQL,
    'cmd' : CONFIG_CMD,
}